package com.qqtech.qquan.delivery.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.qqtech.core.common.util.StringUtil;
import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.core.frame.service.BaseServiceImpl;
import com.qqtech.qquan.delivery.dao.DeliverySysDictDao;
import com.qqtech.qquan.delivery.enums.DeliveryOrderDictTypeConstants;
import com.qqtech.qquan.delivery.model.DeliverySysDict;
import com.qqtech.qquan.delivery.model.DeliverySysDictQuery;
import com.qqtech.qquan.delivery.model.DeliverySysDictVo;

@Service
public class DeliverySysDictServiceImpl extends BaseServiceImpl<DeliverySysDict>
		implements DeliverySysDictService {
	public static final Logger log = LoggerFactory.getLogger(DeliverySysDictServiceImpl.class);
	
	@Resource
	private DeliverySysDictDao deliverySysDictDao;

	@Override
	protected BaseDao<DeliverySysDict> getBaseDao() {
		return deliverySysDictDao;
	}

	@Override
	public DeliverySysDictVo getLogistics(String deliveryName) {
		if (StringUtil.isBlank(deliveryName)) {
			return null;
		}
		DeliverySysDictQuery q = new DeliverySysDictQuery();
		q.setType(DeliveryOrderDictTypeConstants.DICTYPE_DELIVERY_DELIVERY_NAME);
		q.setName(deliveryName);
		List<DeliverySysDictVo> list = deliverySysDictDao.queryList(q);
		if (list != null && !list.isEmpty()) {
			return list.get(0);
		}
		return null;
	}
	
}